//
//  WJPTabBarController.m
//  DuiTang--
//
//  Created by 万贾平 on 16/9/29.
//  Copyright © 2016年 jpw. All rights reserved.
//

#import "WJPTabBarController.h"
#import "WJPNavigationController.h"
#import "WJPHomeTableViewController.h"
#import "WJPMeViewController.h"
#import "WJPShopViewController.h"
#import "WJPFindTableViewController.h"
@interface WJPTabBarController ()

@end

@implementation WJPTabBarController
+(void)load{
    //tabbar字体
    UITabBarItem *item = [UITabBarItem appearanceWhenContainedIn:self, nil];
    NSMutableDictionary *attri = [NSMutableDictionary dictionary];
    attri[NSFontAttributeName] = [UIFont systemFontOfSize:13];
    [item setBadgeTextAttributes:attri forState:UIControlStateNormal];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addChildsVC];
    //tabbar渲染颜色
    self.tabBar.tintColor = [UIColor redColor];
}

-(void)addChildsVC{
    WJPHomeTableViewController *homeVC = [[WJPHomeTableViewController alloc]init];
    WJPNavigationController *nav1 = [[WJPNavigationController alloc]initWithRootViewController:homeVC];
    nav1.tabBarItem.title = @"首页";
    nav1.tabBarItem.image = [UIImage imageNamed:@"tab_icon_home"];
    nav1.tabBarItem.selectedImage = [UIImage imageNamed:@"tab_icon_home_highlight"];
    [self addChildViewController:nav1];
    
    
    WJPFindTableViewController *findVC = [[WJPFindTableViewController alloc]init];
    WJPNavigationController *nav2 = [[WJPNavigationController alloc]initWithRootViewController:findVC];
    nav2.tabBarItem.image = [UIImage imageNamed:@"tab_icon_explore"];
    nav2.tabBarItem.selectedImage = [UIImage imageNamed:@"tab_icon_explore_highlight"];
    nav2.tabBarItem.title = @"发现";
    [self addChildViewController:nav2];
    
    WJPShopViewController *shopVC = [[WJPShopViewController alloc]init];
    WJPNavigationController *nav3 = [[WJPNavigationController alloc]initWithRootViewController:shopVC];
    nav3.tabBarItem.title = @"商品";
    nav3.tabBarItem.image = [UIImage imageNamed:@"tab_icon_store"];
    nav3.tabBarItem.selectedImage = [UIImage imageNamed:@"tab_icon_store_highlight"];
    [self addChildViewController:nav3];
    
//    WJPMeViewController *meVC = [[WJPMeViewController alloc]init];
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"WJPMeViewController" bundle:nil];
     WJPMeViewController *meVC = [sb instantiateViewControllerWithIdentifier:@"MeStoryboard"];
    WJPNavigationController *nav4 = [[WJPNavigationController alloc]initWithRootViewController:meVC];

    nav4.tabBarItem.title = @"我";
    nav4.tabBarItem.image = [UIImage imageNamed:@"tab_icon_me"];
    nav4.tabBarItem.selectedImage = [UIImage imageNamed:@"tab_icon_me_highlight"];
    [self addChildViewController:nav4];
}
@end
